package com.moyq5.mvc.maker.test.bean.entity;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import com.moyq5.mvc.maker.test.bean.embed.AgentFeeId;

/**
 * 代理商费率
 * @author Moyq5
 * @date 2017年12月12日
 */
@Entity
@Table(name = "uc_agent_fee")
@DynamicUpdate
public class AgentFee implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7484146005347612445L;
	/**
	 * 代理商费率ID
	 */
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "agentId", column = @Column(name = "agent_id", nullable = false, precision = 15, scale = 0)),
			@AttributeOverride(name = "feeId", column = @Column(name = "fee_id", nullable = false, precision = 15, scale = 0)) })
	private AgentFeeId id;
	/**
	 * 代理商
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "agent_id", nullable = false, insertable = false, updatable = false)
	private Agent agent;
	/**
	 * 费率
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "fee_id", nullable = false, insertable = false, updatable = false)
	private TraFee fee;
	public AgentFeeId getId() {
		return id;
	}
	public void setId(AgentFeeId id) {
		this.id = id;
	}
	public Agent getAgent() {
		return agent;
	}
	public void setAgent(Agent agent) {
		this.agent = agent;
	}
	public TraFee getFee() {
		return fee;
	}
	public void setFee(TraFee fee) {
		this.fee = fee;
	}
}
